package mango.web.client.admin;

import java.util.ArrayList;
import java.util.List;

import com.google.gwt.user.client.rpc.GwtTransient;

import mango.web.client.C;
import mango.web.client.Vo;

public class FlowerVo extends Vo {
	public Long flowerId;
	public Integer flowerYear;
	public Integer memberId;
	public String contact;
	public String block;
	public Integer regionId;
	public String subRegion;
	public Integer varietyId;
	public Integer tree;

	public String dateList;
	public String percentList;

	@GwtTransient
	public List<String> _percentStringList;

	public List<String> getPercentStringList() {
		if (_percentStringList == null) {
			_percentStringList = this.getStringList(this.percentList);
		}
		return _percentStringList;
	}

	@GwtTransient
	public List<Integer> _treeNumList;

	public List<Integer> getTreeNumList() {
		if (_treeNumList == null) {
			_treeNumList = new ArrayList<Integer>();
			List<String> percentList = this.getPercentStringList();
			Double prePercentD = 0.0;
			for (int j = 0; j < C._memberPropertyVo.columns; j++) {
				if (j < percentList.size()) {
					String percent = percentList.get(j);
					Integer tree = 0;
					if (!"".equals(percent)) {
						Double percentD = Double.parseDouble(percent);
						Double treeD = (0.01 * (percentD - prePercentD) * this.tree);
						tree = treeD.intValue();
						prePercentD = percentD;
					}
					_treeNumList.add(tree);
				}
			}
		}
		return _treeNumList;
	}
}
